.mind-map-container {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-color: rgb(245, 250, 255);
}

/* 调整内容区域避免被固定头部覆盖 */
.mind-map-content {
  width: 100%;
  height: 100%;
  position: relative;
  padding-top: 60px; /* 为顶部工具栏腾出空间 */
  box-sizing: border-box;
}

/* 移除旧的 mind-map-header 元素和任何顶部间距 */
.mind-map-header {
  display: none;
}

.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.toolbar {
  padding: 10px;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.toolbar button {
  padding: 5px 10px;
  background-color: #4285f4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.toolbar button:hover {
  background-color: #3367d6;
}

.toolbar button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.edit-controls {
  display: flex;
  gap: 5px;
}

.edit-controls button {
  padding: 5px 10px;
  background-color: #4285f4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.edit-controls button:hover {
  background-color: #3367d6;
}

.edit-controls button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.infinite-canvas.dragging {
  transition: none !important; /* 拖动时禁用过渡效果 */
}

/* 空格按下时的样式 */
.infinite-canvas.space-pressed {
  cursor: grab !important;
}

/* 拖动时的样式 */
.infinite-canvas.dragging {
  cursor: grabbing !important;
}

/* 添加辅助UI元素的基本样式 */
.connection-mode-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: bold;
  z-index: 1000;
}

.action-feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: bold;
  animation: fadeOut 1s forwards;
  animation-delay: 0.5s;
  z-index: 1000;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent; 
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.action-feedback.undo {
  background-color: rgba(244, 67, 54, 0.7);
}

.action-feedback.redo {
  background-color: rgba(66, 133, 244, 0.7);
}

/* 添加多选状态的反馈样式 */
.action-feedback.selection {
  background-color: rgba(33, 150, 243, 0.7);
  animation: none;
  bottom: 70px;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, 20px); }
  20% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* 添加正在拖动时的样式 */
.mind-map.dragging {
  cursor: grabbing;
}

/* 空格按下时的样式 */
.mind-map.space-pressed {
  cursor: grab !important;
}

.mind-map.dragging {
  cursor: grabbing !important;
}

/* 添加选区框样式 */
.selection-box {
  position: absolute;
  border: 2px dashed #4285f4;
  background-color: rgba(66, 133, 244, 0.1);
  pointer-events: none;
  z-index: 5;
}

.toolbar-drag-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 8px;
  cursor: grab;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px 4px 0 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.toolbar:hover .toolbar-drag-handle {
  opacity: 1;
}

.toolbar.dragging .toolbar-drag-handle {
  cursor: grabbing;
}

/* 自由连线模式指示器 */
.free-connection-mode-indicator {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(66, 133, 244, 0.9);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.3s;
}

/* 绘图层样式 */
.drawing-layer {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  cursor: crosshair !important;
  background: transparent !important;
  z-index: 10 !important;
  pointer-events: all !important;
}

/* 激活状态的工具栏按钮 */
.toolbar-button.active {
  background-color: rgba(66, 133, 244, 0.2);
  border: 1px solid rgba(66, 133, 244, 0.4);
}

/* 自由连线模式下的画布样式 */
.canvas-wrapper.free-connection-mode {
  cursor: cell;
}

.free-connection-mode .infinite-canvas {
  cursor: crosshair !important;
}

.free-connection-mode .card {
  z-index: 15; /* 确保卡片在绘图层之上 */
  cursor: crosshair !important;
  pointer-events: auto !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 自由连线模式下的样式 */
.free-connection-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999 !important;
}

.free-connection-line path {
  stroke: #2196F3;
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 1;
  pointer-events: none;
}

/* 自由连线模式下的画布样式 */
.canvas-wrapper.free-connection-mode {
  cursor: cell;
}

.free-connection-mode .infinite-canvas {
  cursor: crosshair !important;
}

/* 箭头类型指示器 */
.arrow-type-indicator {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(66, 133, 244, 0.9);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.keyboard-hint {
  opacity: 0.8;
  font-size: 12px;
  margin-left: 8px;
}
